#pragma once


#include "ServerImp.h"

namespace frame {
namespace imp {


class DefaultHandlerImp  : public HandlerImp {
public:
    DefaultHandlerImp();
    ~DefaultHandlerImp() override {}

    void connected(ServerChannelImp* serverChannelImp) override;
    void disconnected(ServerChannelImp* serverChannelImp, Error error) override;

    void read(ServerChannelImp * serverChannelImp, const char * buf,  size_t size) override;
    void readException(ServerChannelImp * serverChannelImp, int error) override;

    void writed(ServerChannelImp * serverChannelImp, size_t size) override;
    void writeException(ServerChannelImp * serverChannelImp, int error) override;

    static DefaultHandlerImp * instance();

private:    
    //TODO to be thread-safe 
    static DefaultHandlerImp * __inst;
};

} //end of namespace  imp
} //end of namespace  frame
